<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <style>
        .red{
            background: red;
            height: 100px;
        }
        .orange{
            background: orange;
            height: 100px;
        }
        .yellow{
            background: yellow;
            height: 100px;
        }
        .teal{
            background: teal;
            height: 100px;
        }
        ul li{
            display: inline-block;
            list-style: none;
            width: 150px;
            margin: 10px;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 语法： :class="{类名1:true,类名2:false,...}" -->
        <div :class="{'red':true,'yellow':isYellow,'orange':1==1 }">业精于勤荒于嬉</div>

        <h1>案例：三行一变身</h1>
        <ul>
            <li v-for="(item,index) in arr" :class="{'red':index%3==0,'orange':index%3==1,'teal':index%3==2}">{{item}}</li>
            <!-- index:0   red    0 3 6 9 12   index%3==0
                 index:1   orange 1 4 7 10 13  index%3==1
                 index:2   teal   2 5 8 11 14  index%3==2
                 index:3   red
                 index:4   orange
                 index:5   teal
            -->
        </ul>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                isYellow:false,
                arr:[1,2,3,4,5,6,7,8,9,10]
            },
            methods:{}
        })
    </script>
</body>
</html>